<?php
/**
 * Created by PhpStorm.
 * User: zhixuan
 * Date: 2019/11/20
 * Time: 12:08
 */

namespace app\admin\validate;


use think\Validate;

class ManageValidate extends Validate
{
    protected $rule =   [
        'full_name'  => 'require',
        'account'   => 'require|unique:manage|alphaNum|min:6',
        'password'   => 'require',
        'role_id'   => 'require',
        'repassword'=>'confirm:password',
    ];

    protected $message  =   [
        'full_name.require' => '姓名不能为空',
        'account.require'   => '账号不能为空',
        'account.unique'    => '账号已存在',
        'account.alphaNum'  => '账号只能是字母与数字组合',
        'account.min'       => '账号的长度不能少于6位',
        'password.require'   => '密码不能为空',
        'role_id.require'   => '角色不能为空',
        'repassword.confirm'=>'两次密码输入不一致',
    ];

    protected $scene = [
        'add'  =>  ['full_name', 'account','password','role_id','repasswprd'],
        'edit'  =>  ['full_name','role_id'],
    ];
}